package com.zx.mes.hyl.weather.controller;

import com.zx.mes.hyl.weather.entity.WeatherResponse;
import com.zx.mes.hyl.weather.service.WeatherDataServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * controller
 * @author hyl
 * @date 2018-3-1
 */
@RestController
@RequestMapping("/weather")
public class WeatherDataController {

    @Autowired
    private WeatherDataServiceI weatherDataService;

    @ResponseBody
    @GetMapping("/cityName/{cityName}")
    public WeatherResponse getWeatherDataByCityName(@PathVariable("cityName") String cityName){
        return weatherDataService.getDataByCityName(cityName);
    }

}
